package com.east.controller;


import com.east.dto.ClueRemarkDTO;
import com.east.result.Result;
import com.east.service.ClueRemarkService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/clueRemark/")
public class ClueRemarkController {
    @Resource
    private ClueRemarkService clueRemarkService;

    /**
     * 保存 线索追踪信息
     *
     * @param clueRemarkDTO
     * @return
     */
    @PostMapping("save")
    public Result save(@RequestBody ClueRemarkDTO clueRemarkDTO) {
        return clueRemarkService.save(clueRemarkDTO);
    }

    @GetMapping("list")
    public Result list(@RequestParam(value = "currentPage", defaultValue = "1", required = false) Integer currentPage,
                       @RequestParam(value = "pageSize", defaultValue = "2", required = false) Integer pageSize,
                       @RequestParam(value = "clueId") Integer clueId) {
        return clueRemarkService.list(currentPage, pageSize, clueId);
    }

    @GetMapping("info/{id}")
    public Result info(@PathVariable("id") Integer clueRemarkId) {
        return clueRemarkService.info(clueRemarkId);
    }

    @PutMapping("update")
    public Result update(@RequestBody ClueRemarkDTO clueRemarkDTO) {
        return clueRemarkService.update(clueRemarkDTO);
    }

    @PutMapping("delete/{id}")
    public Result delete(@PathVariable("id") Integer id) {
        return clueRemarkService.delete(id);
    }
}
